<script>
import {bus} from "vue3-eventbus";

export default {
  name: "TabbarCom",
  data(){
    return{
      currentIndex:1,
    }
  },
  methods:{
    loginOut(){
      bus.emit("changeTabbar", {account:'',mode:true})
    },
    pageJumpTo(index){
      bus.emit('pageJumpTo',index)
      this.currentIndex = index;
    }
  }
}
</script>

<template>
  <div class="tabbar-container">
    <!--跳转按钮-->
    <div class="jump-btn-container">
      <button @click="pageJumpTo(1)" :class="currentIndex === 1?'chosen-btn':'unchosen-btn'">Control</button>
      <button @click="pageJumpTo(2)" :class="currentIndex === 2?'chosen-btn':'unchosen-btn'">Manage</button>
      <button @click="pageJumpTo(3)" :class="currentIndex === 3?'chosen-btn':'unchosen-btn'">Analysis</button>
      <button @click="pageJumpTo(4)" :class="currentIndex === 4?'chosen-btn':'unchosen-btn'">Simulate</button>
      <button @click="pageJumpTo(5)" :class="currentIndex === 5?'chosen-btn':'unchosen-btn'">Demo</button>
      <button style="color: #333" class="log-out-btn" @click="loginOut">Sign Out</button>
    </div>
  </div>
</template>

<style scoped>
.tabbar-container{
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  background-color: #fbfbfb;
}
.jump-btn-container{
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  display: flex;
  justify-content: center;

}
.jump-btn-container button{
  padding: 0 28px;
  border: none;
  margin-left: 1px;
  position: relative;
  background-color: transparent;
  font-size: 14px;

  cursor: pointer;
  font-weight: bold;
  transition: .4s;
}
.jump-btn-container button:hover{
  color: #5471c0;
  transition: .4s;
}
.jump-btn-container button::before{
  content: "";
  height: 4px;
  width: 4px;
  border-radius: 2px;
  background-color: #555;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}
.jump-btn-container button:nth-last-child(1)::before{
  content: "";
  height: 4px;
  width: 4px;
  border-radius: 2px;
  background-color: transparent;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}
.unchosen-btn{
  color: #aaa;
}
.chosen-btn{
  color: #333;
}
.chosen-btn::after{
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 24px;
  height: 4px;
  border-radius: 2px;
  color: #000;
  background-color: #5471c0;
}

</style>